//
//  ATApiResult.m
//  AT
//
//  Created by xiao6 on 2017/11/15.
//  Copyright © 2017年 FDLive. All rights reserved.
//

#import "ATApiResult.h"

@implementation ATApiResult
- (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
    self.code = self.success ? ATApiCodeSuccess : ATApiCodeFail;
    return YES;
}
- (BOOL)isSuccess {
    return self.code == ATApiCodeSuccess;
}
- (BOOL)isServerNotFound {
    return self.code == ATApiCodeServerNotFound;
}
- (BOOL)isNeedLogin {
    return self.code == ATApiCodeNeedLogin || self.code == ATApiCodeTokenError;
}
- (NSString *)description {
    NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
    dic[@"requestURL"] = self.requestUrl;
    dic[@"headParams"] = self.headParams;
    dic[@"params"] = self.params;
    dic[@"data"] = self.data;
    dic[@"message"] = self.message;
    dic[@"code"] = @(self.code);
    return [NSString stringWithFormat:@"%@", dic];
}
@end
